package com.ecfront.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Map;

/**
 * 信件标题和正文读取模块
 * @author www.ecfront.com
 */
public class SendByEmail {
	
	private String user;//传递的发送对象的user
	private String emailTitle;//发送标题
	private String emailBody;//发送正文
	private BufferedReader readerFile;//email接收正文流
		
	private String param = "{username}";
	/**
	 * 初始化发送信件
	 * @param user
	 */
	public SendByEmail(String user) {
		this.user = user;
	}
	/**
	 * 文件流转换成字符串
	 * @param file
	 */
	private String converFileToString(String file){
		try {
			StringBuffer str = new StringBuffer();
			readerFile = new BufferedReader(new InputStreamReader(
					new FileInputStream(file)));
			String line = null;
			while((line = readerFile.readLine())!=null){
				str.append(line);
			}
			return str.toString();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}
	/**
	 * 替换字符串
	 * @return 替换成功后的
	 */
	private String replaceString(){
		return null;
	}
	/**
	 * 返回Email的正文
	 * @return Email正文
	 */
	public String getBody(){
		return emailBody;
	}
	/**
	 * 返回Email的标题
	 * @return Email标题
	 */
	public String getTilte(){
		return emailTitle;
	}
}
